﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace WorldConqueror.Libraries.MVCExtensions.Helpers
{
    public class MethodInfoHelper : IMethodInfoHelper
    {
        public string GetMethodName(Expression<Action> action)
        {
            var methodCallExpression = action.Body as MethodCallExpression;

            if (methodCallExpression != null)
            {
                return methodCallExpression.Method.Name;
            }
            
            return null;
        }
    }
}
